<!DOCTYPE html>
<html>
<include file="Public:header" />
<link href="__ACSS__/dialog.css" rel="stylesheet">
<link href="__ACSS__/plugins/validform/validform.css" rel="stylesheet">
<style>
	.form-control{ padding-left:5px;}
	.upload-warp{ position:relative;}
	.upload-btn{ position:absolute; top:0; right:0; border-radius:0;}
	
	.file-preview {border:1px solid #ddd; padding:5px; width:100%; margin-bottom:5px;}
	.file-preview-frame{ margin:8px; border:1px solid #ddd; box-shadow:1px 1px 5px 0px #a2958a; padding:6px; float:left; text-align:center; vertical-align:middle;}
	.file-preview-frame .btn{ float:right; margin-top:5px;}
	.file-preview-text{ color:#428bca; font-size:11px; text-align:center;}
	
	.province-box .checkbox-inline{ margin-bottom:10px;}
</style>
  <body>
	  <div class="wrapper wrapper-content">
	  	<form role="form" class="form" action="__URL__/insert">
			<input type="hidden" name="create_time" value="<php>echo time();</php>">
			<input type="hidden" name="flag" value="1">
			<div class="form-group">
				<label class="col-sm-2 control-label">名称：</label>
				<div class="col-sm-10">
					<input type="text" datatype="*" name="name" class="form-control" placeholder="名称" ajaxurl="__URL__/checkName">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">选择区域：</label>
				<div class="col-sm-10 province-box">
					<foreach name="list" item="list">
						<label class="checkbox-inline <if condition="in_array($list['id'],$arr)">disabled</if>">
							<input type="checkbox" value="<{$list.id}>" class="province" <if condition="in_array($list['id'],$arr)">disabled</if>> <{$list.province}>
						</label>
					</foreach>
					<input type="hidden" datatype="*" name="province_ids" class="province_ids"  value=""/>
					<div class="clearfix"></div>
				</div>
			</div>
			<div class="clearfix"></div>
			<br/>
			<div class="clearfix">
				<button type="submit" id="submit" class="btn btn-success btn-block">提交</button>
				<button type="reset" id="reset2" class="btn btn-success btn-block hidden">重置</button>
			</div>
		</form>
	  </div>
  </body>
<!-- 全局js -->
<include file="Public:foot" />
<script src="__AJSPLUGINS__/validform/Validform_v5.3.2_min.js"></script>
<script>
$(function(){
	$("#reset2").click();
	var index = parent.layer.getFrameIndex(window.name);
	var form = $(".form").Validform({
		tiptype:4,
		ajaxPost:true,
		beforeCheck:function(curform){
			var str = "";
			$(".province").each(function(){
				if($(this).is(':checked')){
					if(str != ""){str += "|";}
					str += $(this).val();
				}
			})
			$(".province_ids").val(str);
		},
		callback:function(data){
			if(data.status == 1) {
				window.parent.layer.msg(data.info);
				window.parent.$('#table_list').trigger("reloadGrid");
			}else{
				window.parent.layer.msg(data.info);
			}
			parent.layer.close(index);
		}
	});
})
</script>
</html>